﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PC.AzureMultiApp.Core.Models;
using PC.AzureMultiApp.Storage;

namespace PC.AzureMultiApp.Core.Helpers
{
    public static class Conversions
    {
        public static ApplicationModel GetApplicationModel(AzureApplicationEntity app)
        {
            return new ApplicationModel()
            {
                ApplicationName = app.ApplicationName,
                ApplicationUrl = app.ApplicationUrl,
                BlobUrl = app.BlobUrl,
                Name = app.Name,
                Label = app.Label,
                Status = app.Status,
                Version = app.Version,
                UniqueId = app.UniqueId,
                IsWebDeploy = app.IsWebDeploy
            };
        }

        public static AzureApplicationEntity GetAzureApplication(ApplicationModel app)
        {
            return new AzureApplicationEntity()
            {
                ApplicationName = app.ApplicationName,
                ApplicationUrl = app.ApplicationUrl,
                BlobUrl = app.BlobUrl,
                Name = app.Name,
                Label = app.Label,
                Status = app.Status,
                Version = app.Version,
                UniqueId = app.UniqueId,
                IsWebDeploy = app.IsWebDeploy
            };
        }

        public static AzureCounterModel GetCounter(AzureCounterEntity counter)
        {
            return new AzureCounterModel()
            {
                EventDateTime = counter.EventDateTime,
                RoleInstance = counter.RoleInstance,
                CounterName = counter.CounterName,
                CounterValue = counter.CounterValue,
            };
        }

        public static AzureEventModel GetAzureEvent(AzureEventEntity azureEvent)
        {
            return new AzureEventModel()
            {
                EventDateTime = azureEvent.EventDateTime,
                RoleInstance = azureEvent.RoleInstance,
                Description = azureEvent.Description,
                Level = azureEvent.Level,
                ProviderName = azureEvent.ProviderName,
                RawXml = azureEvent.RawXml
            };
        }
    }
}
